package com.mdinfo.db.test.token;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * Created by Administrator on 2018/1/8.
 */
public class FutureTest2 {

    public static void main(String[] args){

        FutureTask<Integer> futureTask = new FutureTask<Integer>(()->{
            System.out.println("abc");
            return 1;
        });
        new Thread(futureTask).start();
        try {
            Integer integer = futureTask.get();
            System.out.println(integer);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
